<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="${assetsPath}/css/bootstrap-theme.min.css" />
<link rel="stylesheet" type="text/css" href="${assetsPath}/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="${viewPath}/resources/css/main.css" />
<link rel="stylesheet" type="text/css" href="${assetsPath}/js/select2/select2.css" />
<link rel="stylesheet" type="text/css" href="${assetsPath}/js/datetimepicker/bootstrap-datetimepicker.min.css" />
<link rel="shortcut icon" href="${viewPath}/resources/images/default.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="${assetsPath}/css/zTreeStyle.css" />
<style>
<!--
.ui-dialog-close {
	font-size:21px !important;
}
-->
</style>
<script type="text/javascript" src="${assetsPath}/js/jquery/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="${assetsPath}/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${assetsPath}/js/select2/select2.min.js"></script>
<script type="text/javascript" src="${assetsPath}/js/datetimepicker/moment-with-langs.min.js"></script>
<script type="text/javascript" src="${assetsPath}/js/datetimepicker/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="${assetsPath}/js/datetimepicker/bootstrap-datetimepicker.zh-CN.js"></script>
<script type="text/javascript" src="${assetsPath}/js/jquery.ztree.core-3.5.js"></script>
<!-- seajs引用 -->

<script type="text/javascript" src="${assetsPath}/js/seajs/sea-2.2.1-min.js" id="seajsnode"></script>
<script type="text/javascript">

<!-- 相当于定义了一个jquery的seajs插件，此时jquery已经载入，window.jQuery已可用 -->
define("jquery", [], function(require, exports, module) {
	module.exports = window.jQuery;
});

<!-- 给jquery的seajs插件起别名，此别名是在seajs插件中起作用 -->
seajs.config({
	alias : {
    	"$" : "jquery",
    	"artdialog" : "${basePath}${assetsPath}/js/artdialog6/dialog-plus.js"
  	},
});

define("init", [], function(require, exports, module) {
	var $ = require("$");
	window.$.artdialog = require("artdialog");
	return $;
});

<!-- 由于是异步加载，通常会晚于document.ready事件。因为此时jquery已加载结束 -->
seajs.use(["init", "artdialog"], function($) {
	initDialogs();
	$(function(){
		if(typeof documentReady === "function"){
			documentReady.apply();
		}
	});
});

$.fn.initPageBar = function(options, callback) {
	var pageBar = $(this);
	var pageNo = options.pageNo;
	var pageSize = options.pageSize;
	var prevPageNo = options.prevPageNo;
	var nextPageNo = options.nextPageNo;
	var totalPages = options.totalPages;
	var totalResults = options.totalResults;
	$("a.first",pageBar).attr("data","1");
	$("a.prev",pageBar).attr("data",prevPageNo);
	$("a.next",pageBar).attr("data",nextPageNo);
	$("a.last",pageBar).attr("data",totalPages);
	$(":input[name=current]").val(pageNo);
	$("span.pages",pageBar).text(totalPages);
	$("span.records",pageBar).text(totalResults);
	
	if(pageNo == 1){
		$("a.prev",pageBar).parent().addClass("disabled");
	}else{
		$("a.prev",pageBar).parent().removeClass("disabled");
	}
	if(pageNo == totalPages){
		$("a.next",pageBar).parent().addClass("disabled");
	}else{
		$("a.next",pageBar).parent().removeClass("disabled");
	}
	
	$("a", pageBar).unbind("click");
	$("a", pageBar).click(function(){
		var jumpTo = $(this).attr("data");
		var intJumpTo = parseInt(jumpTo);
		
		if(!isNaN(intJumpTo) && !$(this).parent().hasClass("disabled")){
			if(intJumpTo > totalPages){
				intJumpTo = totalPages;
			}
			if(intJumpTo < 1) {
				intJumpTo = 1;
			}
			callback.apply(pageBar,[intJumpTo,pageSize,pageBar]);
		}
	});
	
	$(":input[name=current]",pageBar).unbind("change");
	$(":input[name=current]",pageBar).change(function(){
		var jumpTo = $(this).val();
		$(this).parent().attr("data",jumpTo);
	});
}

//初始化对话框
function initDialogs(){
	window.alert = function(content) {
		var d = $.artdialog({
			title : "消息",
			content : content,
			ok : function(){},
			okValue : "确定",
			width : 300
		});
		d.showModal();
		return d;
	}
	
	window.wait = function(content) {
		var d = $.artdialog({
			title : "提示",
			content : "<div class='wait-loading' style='float:left;'>&nbsp;</div><div style='float:left;height:32px;line-height:32px;vertical-align:middle;margin-left:20px;'>"+ (content || "请稍候...") + "</div>",
			cancel : false,
			width : 300
		});
		d.showModal();
		return d;
	}
	
	window.error = function(content) {
		var d = $.artdialog({
			title : "错误",
			content : "<span style='color:red;'>" + (content || "错误，请联系管理员") + "</span>",
			ok : function(){},
			okValue : "确定",
			width : 300
		});
		d.showModal();
		return d;
	}
	
	window.confirm = function(content, callbackOk, callbackCancel) {
		var d = $.artdialog({
			title : "确认",
			content : content,
			ok : function(){
				if(callbackOk && typeof callbackOk === "function") {
					callbackOk.apply(this);
				}
			},
			okValue : "确定",
			cancel : function(){
				if(callbackCancel && typeof callbackCancel === "function") {
					callbackCancel.apply(this);
				}
			},
			cancelValue : "取消",
			width : 300
		});
		d.showModal();
		return d;
	}
	
	window.tooltip = function(dom, content){
		var d = $.artdialog({
			content : content,
			quickClose : true
		});
		d.show(dom);
		return d;
	}
}

</script>

<script type="text/javascript">
	$(function() {
		/* $(".selectpicker").selectpicker(); */
		
		$(".selectpicker").select2({
			width: "100%"
		});
	});
</script>